<%--
  Created by IntelliJ IDEA.
  User: asus
  Date: 2020/9/11
  Time: 10:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fm" uri="http://www.springframework.org/tags/form" %>

<%@include file="../index.jsp"%>

<script src="../../../statics/calendar/WdatePicker.js"></script>

<div class="right">
    <div class="location">
        <strong>你现在所在的位置是:</strong>
        <span>用户管理页面 >> 用户添加页面</span>
    </div>
    <div class="providerAdd">
        <form id="userForm" name="userForm" method="post" action="addUser" enctype="multipart/form-data">
            <!--div的class 为error是验证错误，ok是验证成功-->
            <div>
                <label for="userCode">用户编码：</label>
                <input type="text" name="usercode" id="userCode" value="">
                <!-- 放置提示信息 -->
                <font id="code"></font>
            </div>
            <div>
                <label for="userName">用户名称：</label>
                <input type="text" name="username" id="userName" value="">
                <font color="red"></font>
            </div>
            <div>
                <label for="userPassword">用户密码：</label>
                <input type="password" name="userpassword" id="userPassword" value="">
                <font color="red"></font>
            </div>
            <div>
                <label for="ruserPassword">确认密码：</label>
                <input type="password" name="ruserPassword" id="ruserPassword" value="">
                <font color="red"></font>
            </div>
            <div>
                <label >用户性别：</label>
                <select name="gender" id="gender">
                    <option value="1" selected="selected">男</option>
                    <option value="0">女</option>
                </select>
            </div>
            <div>
                <label for="birthday">出生日期：</label>
                <input type="text" Class="Wdate" id="birthday" name="birthday" readonly="readonly" onclick="WdatePicker();">
                <font color="red"></font>
            </div>
            <div>
                <label for="phone">用户电话：</label>
                <input type="text" name="phone" id="phone" value="">
                <font color="red"></font>
            </div>
            <div>
                <label for="address">用户地址：</label>
                <input name="address" id="address"  value="">
            </div>
            <div>
                <label >用户角色：</label>
                <!-- 列出所有的角色分类 -->
                <select name="userRole" id="userRole">
                    <option value="0">--请选择--</option>
                    <c:forEach items="${sessionScope.list}" var="role" varStatus="status">
                        <option value="${role.id}">${role.rolename}</option>
                    </c:forEach>
                </select>
                <font color="red"></font>
            </div>
            <%--<div>--%>
                <%--<label for="a_idPicPath">证件照：</label>--%>
                <%--<input type="file" name="cardphoto" id="a_idPicPath"/>--%>
                <%--<font color="red"></font>--%>
            <%--</div>--%>
            <%--<div>--%>

                <%--<label for="a_workPicPath">工作证照片：</label>--%>
                <%--<input type="file" name="workphoto" id="a_workPicPath"/>--%>
                <%--<font color="red"></font>--%>
            <%--</div>--%>
            <div class="providerAddBtn">
                <input type="submit" name="add" id="add" value="保存" >
                <input type="button" id="back" name="back" value="返回" >
            </div>
        </form>
    </div>

    <div class="zhezhao"></div>
    <div class="remove" id="removeUse">
        <div class="removerChid">
            <h2>提示</h2>
            <div class="removeMain">
                <p>你确定要放弃当前编辑回到主页面吗？</p>
                <a href="#" id="yes">确定</a>
                <a href="javascript:void(0)" id="no">取消</a>
            </div>
        </div>
    </div>
</div>

                <script src="../../../statics/js/jquery-1.9.1.min.js"></script>
                <script>
                    $(function () {
                        bindData();
                    })

                    function bindData() {
                        var usercode = $("#userCode").val();

                        $("#back").click(function () {
                            $(".zhezhao,.remove").show()
                        })

                        $("#yes").click(function(){

                            window.location = "userlist.jsp"
                        })


                        //点击no
                        $("#no").click(function(){
                            $(".zhezhao,.remove").hide()
                        })

                        $.post("usercode",{"usercode" : usercode},function (msg) {
                            if (msg = 0){
                                $("#code").html("用户编码不可用！").css("color : red");
                            }else{
                                $("#code").html("用户编号可用！").css("color : green");
                            }
                        },"json")
                    }
                </script>

</section>
<%@include file="../foot.jsp"%>
